import qs from 'querystring';

export const getData = (url) => {
    let result = fetch(url).then(res => res.json())
    return result
}

export const postData = (url, data) => {
    let result = fetch(url, {
        method: "post",
        headers: {
            'Accept': 'application/json, text/plain, */*',
            'Content-Type': 'application/x-www-form-urlencoded'
        },
        body: qs.stringify(data)
    }).then(res => res.json())
    return result
}